package com.twu.biblioteca.model;

import java.util.ArrayList;
import java.util.List;

public class User {

    private Integer id;
    private String name;
    private String libraryNumber;
    private String password;
    private List<UserType> roles;
    private List<Title> myTitles;
    private String email;
    private String phoneNumber;

    public User(String name, String libraryNumber, String password, String email, String phoneNumber) {
        this.name = name;
        this.libraryNumber = libraryNumber;
        this.password = password;
        roles = new ArrayList<UserType>();
        myTitles = new ArrayList<Title>();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public String getLibraryNumber() {
        return libraryNumber;
    }

    public String getPassword() {
        return password;
    }

    public List<UserType> getRoles() {
        return roles;
    }

    public void addRole(UserType userType){
        if (!roles.contains(userType)){
            roles.add(userType);
        }
    }

       public List getTitles() {
        return myTitles;
    }

    public boolean isLibrarian(){
        return roles.contains(UserType.LIBRARIAN);
    }

    public String getEmail() {
        return email;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }
}
